package com.thrblock.needle.bean;

import engineextend.util.actiontemplet.TempletAlph;
import geivcore.UesContext;
import geivcore.Uesi;
import geivcore.engineSys.serialTaskcontroller.SerialTask;
import geivcore.enginedata.obj.Obj;

public class Flag implements SerialTask{
	static Uesi ues = UesContext.getCurrentContext();
	Obj flag = ues.creatObj(Uesi.GameObjIndex);
	static final String SMALL_HJ = ues.preInitTexture(Flag.class.getResourceAsStream("SMALLHJ.png"));
	public Flag() {
		flag.addGLImage(SMALL_HJ);
		flag.setCentralX(ues.getScreenWidth()/2);
		flag.setCentralY(ues.getScreenHeight()/2+ Needle.rad + 70f);
		flag.setAllAlph(0);
		ues.addSerialTask(this);
	}
	public void enable() {
		flag.show();
	}
	public void disable() {
		flag.hide();
	}
	public void tear() {
		flag.setAllAlph(0);
		flag.setCentralY(ues.getScreenHeight()/2+ Needle.rad + 70f);
	}
	@Override
	public void serial(int clock) {
		if(flag.isPrintable()) {
			if(!TempletAlph.tearIn(flag, 1.0f,0.08f)){
				flag.setDyOffset(-1.0f);
			}
		}
	}
}
